<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // json格式的数据
        //    {}    键名需要加双引号   键值如果是字符串就需要加双引号
        //    []

        const xhr = new XMLHttpRequest();
        xhr.open('get', '../data/3.json', true);
        xhr.send();
        xhr.onreadystatechange = function () {
            if (this.readyState === 4 && this.status === 200) {
                let data = this.responseText;
                data = JSON.parse(data);
                console.log(data);
            }
        }


    </script>

</body>

</html>